<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\modules\home\models\Consult */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => '咨询列表', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="consult-view">

    <div class="box box-primary">
        <div class="box-header with-border">
          <h3 class="box-title">操作</h3>
        </div>
        <div class="box-body">
            <p>
                <?= Html::a('编辑', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
                <?= Html::a('删除', ['delete', 'id' => $model->id], [
                    'class' => 'btn btn-danger',
                    'data' => [
                        'confirm' => 'Are you sure you want to delete this item?',
                        'method' => 'post',
                    ],
                ]) ?>
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <div class="box box-solid box-primary">
                <div class="box-header">
                  <h3 class="box-title">详情</h3>
                </div>
                <div class="box-body">
                    <?= DetailView::widget([
                        'model' => $model,
                        'attributes' => [
                            'id',
                            'usename',
                            'phone',
                            'question',
                            [
                                'format' => 'raw',
                                'attribute' => 'status',
                                'value' => function($model) {
                                    if($model->status==0){
                                        return "<span class='btn btn-info btn-xs'>未处理<span>";
                                    }elseif($model->status==1){
                                        return "<span class='btn btn-success btn-xs'>已处理<span>";
                                    }else{
                                        return "";
                                    }
                                },
                            ],
                            'remark',
                            [
                                'format' => 'raw',
                                'attribute' => 'create_at',
                                'value' => function($model) {
                                    return date('Y-m-d H:i', $model->create_at);
                                },
                            ],
                            [
                                'format' => 'raw',
                                'attribute' => 'update_at',
                                'value' => function($model) {
                                    return date('Y-m-d H:i', $model->update_at);
                                },
                            ],
                        ],
                    ]) ?>
                </div>
            </div>
        </div>

        <div class="clearfix"></div>
    </div>


</div>
